use SMS
drop procedure SMS_InsertUpdatepProduct
go
create procedure SMS_InsertUpdatepProduct
	@isUpdate bit,
	@productId int,
	@categoryId int,
	@productName nvarchar(50),
	@barcode nvarchar(20),
	@description ntext,
	@price decimal
as
	if(@isUpdate = 1)
		begin
			update Products
			set categoryId= @categoryId,
				productName= @productName,
				barcode= @barcode,
				description= @description,
				price= @price
			where productId= @productId
		end
	else
		begin
			insert into Products(categoryId, productName, barcode, description, price)
			values (@categoryId, @productName, @barcode, @description, @price)
		end
